package com.learn.springlearn.controller;

import com.learn.springlearn.config.RoleConfig;
import com.learn.springlearn.constant.CarEnum;
import com.learn.springlearn.request.EnumRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.web.bind.annotation.*;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

@RestController()
@RequestMapping(value = "enum")
public class EnumController {

    Logger  logger = LoggerFactory.getLogger("aa");

    @Autowired
    RoleConfig roleConfig;

    @Autowired
    A a;




    @PostMapping("get")
    public String getEnum(@RequestBody EnumRequest request) throws ExecutionException, InterruptedException {
        System.out.println("获取到的枚举值："+request.getCarEnum().getDesc());
        System.out.println("获取到的枚举值："+request.getCarEnum().getValue());
//        roleConfig.getRoleMap().forEach((s, integer) -> System.out.println("key:" +s+"   value:" + integer));
        System.out.println(Thread.currentThread().getName());
        Future<String> stringFuture = a.longTime();
        String s = stringFuture.get();
        return s;

    }



}
